
local rpc = require'rpc'
local arq_interface = require"myobj1_interface"

myobj1 = { foo = function (a, b, s)
                 print('foo1',a,b,s)
                 return a+b, "alo alo"
                 --return nil, "alo alo"
               end,
          boo = function (n)
                  return n
                end
        }
myobj2 = { foo = function (a, b, s)
                 return a-b, "tchau"
               end,
          boo = function (n)
                  return 1
                end
        }
rpc.setServIp("*")
-- cria servidores:
serv1 = rpc.createServant (myobj1, arq_interface)
serv2 = rpc.createServant (myobj2, arq_interface)
print('serv1 ip='..serv1.ip..' port='..serv1.port)
print('serv2 ip='..serv2.ip..' port='..serv2.port)

rpc.waitIncomming()

